/*
 * Copyright ©2015-2021 Jaemon. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gitee.jaemon.spring.adorner.starter;

import io.gitee.jaemon.spring.adorner.SpringAdornerStarter;
import io.gitee.jaemon.spring.adorner.core.AdornerApplicationContext;
import io.gitee.jaemon.spring.adorner.demo.controller.UserController;
import io.gitee.jaemon.spring.adorner.extend.EnhanceNoteScanner;
import io.gitee.jaemon.spring.adorner.type.DocScanner;
import io.gitee.jaemon.spring.adorner.util.AdornerUtils;

import java.io.File;

/**
 * 扩展使用示例启动类
 *
 * @author Jaemon
 * @since 1.0
 */
public class ExtendStarter {
    public static void main(String[] args) {
        String filePath = "C:\\Users\\answer\\Desktop\\adorner\\api\\adorner-api.md";
        String[] packages = new String[]{
                "io.gitee.jaemon.spring.adorner.demo.controller"
        };
        DocScanner docScanner = DocScanner.of(
                AdornerUtils.newArrayList(
                        "io.gitee.jaemon.spring.adorner.demo.controller",
                        "io.gitee.jaemon.spring.adorner.demo.entity"
                ),
                // 因为当前接口类定义在test包下，所以需要指定classpath为test所在路径
                System.getProperty("user.dir") + File.separator + "src\\test\\java"
        );
        String logpath = "C:\\Users\\answer\\Desktop\\adorner\\log";

        AdornerApplicationContext context = AdornerApplicationContext.builder()
                .group(true)
                .includeClasses(AdornerUtils.newArrayList(UserController.class))
                .docScanner(docScanner)
                .logpath(logpath)
                .build(filePath, packages);

        // 采用自定义注释扫描器
        SpringAdornerStarter.generate(context, new EnhanceNoteScanner());

    }
}